package com.itfreer.ui.base.validations;

import android.text.TextUtils;
import android.widget.EditText;

/**
 * 校验模型
 * @Description: 
 * @author ken.cai
 * @date 2014-11-21 下午9:38:40 
 * @version V1.0   
 * 
 */
public class ValidationModel {
	private EditText editText;
	private ValidationExecutor validationExecutor;
	/**
	 * 验证标题
	 */
	private String validateTitle;

	public ValidationModel(EditText editText,ValidationExecutor validationExecutor, String validateTitle) {
		this.editText = editText;
		this.validationExecutor = validationExecutor;
        this.validateTitle = validateTitle;
	}
	
	public EditText getEditText() {
		return editText;
	}

	public ValidationModel setEditText(EditText editText) {
		this.editText = editText;
		return this;
	}

	public ValidationExecutor getValidationExecutor() {
		return validationExecutor;
	}

	public ValidationModel setValidationExecutor(ValidationExecutor validationExecutor) {
		this.validationExecutor = validationExecutor;
		return this;
	}

	public boolean isTextEmpty() {
		if (editText==null||TextUtils.isEmpty(editText.getText())) {
			return true;
		}
		return false;
	}

    /**
     * 获取验证标题
     * @return
     */
    public String getValidateTitle(){
        return validateTitle;
    }

    /**
     * 设置验证标题
     * @param validateTitle
     */
    public void setValidateTitle(String validateTitle){
        this.validateTitle = validateTitle;
    }
}